package com.app.shortvideo.base

import android.app.Activity
import android.app.Application
import android.os.Bundle
import java.util.*

class MyActivityManager : Application.ActivityLifecycleCallbacks {

    lateinit var mActivityManagerStack: Stack<Activity>

    constructor() {
        mActivityManagerStack = Stack<Activity>()
    }

    public fun getStack(): Stack<Activity> {
        return mActivityManagerStack
    }

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
        mActivityManagerStack.push(activity)
    }

    override fun onActivityStarted(activity: Activity) {

    }

    override fun onActivityResumed(activity: Activity) {

    }

    override fun onActivityPaused(activity: Activity) {

    }

    override fun onActivityStopped(activity: Activity) {

    }

    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {

    }

    override fun onActivityDestroyed(activity: Activity) {
        mActivityManagerStack.remove(activity)
    }
}
